The Numeric Widgets

Int Widgets

  • IntText
  • BoundedIntText
  • IntProgress
  • IntSlider
  • IntRangeSlider

Float Widgets

  • FloatText
  • BoundedFloatText
  • FloatProgress
  • FloatSlider
  • FloatRangeSlider

NOTE: Only the Int widgets are shown in this notebook. The Float widgets are the same as their Int counterparts, but hold Floats instead of Ints.


In [1]:
{-# LANGUAGE OverloadedStrings #-}
import IHaskell.Display.Widgets

IntText and BoundedIntText


In [2]:
int <- mkIntText
int

In [3]:
bit <- mkBoundedIntText
bit

Both the widgets are similar, but the second one possesses some additional properties.


In [4]:
setField bit MaxInt 20
setField bit MinInt 10
setField bit ChangeHandler (getField bit IntValue >>= print)



Now, the first widget will accept arbitrary input whereas the second one wil accept input in the the 10-20 range. For example, try entering large values and hitting return/enter in the second widget.

IntSlider and IntRangeSlider

Both these widgets are sliders (duh!). IntSlider represents a single value, whereas IntRangeSlider represents a pair (range) of values.


In [5]:
ins <- mkIntSlider
irs <- mkIntRangeSlider

In [6]:
ins
irs

In [7]:
getField irs IntPairValue


(25,75)

IntProgress

This widget is meant to be used as a progress bar.


In [8]:
inp <- mkIntProgress
inp

In [9]:
setField inp IntValue 42